# Copyright (C) 2014-2021  CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#

from salome.shaper import model

model.begin()
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
model.addParameter(Part_1_doc, "BHD", "8", "Base Hole Diameter")
model.addParameter(Part_1_doc, "BHPD", "14", "Base Hole Plate Diameter")
model.addParameter(Part_1_doc, "BHPS", "2", "Base Hole Plate Thickness")
model.addParameter(Part_1_doc, "BHPFR", "BHPS/4*3", "Base Hole Plate Fillet Radius")
model.addParameter(Part_1_doc, "BPS", "6", "Base Plate Thickness")
model.addParameter(Part_1_doc, "Draft", "100", "Bracket Draft")
model.addParameter(Part_1_doc, "TDI", "14", "Tube Internal Diameter")
model.addParameter(Part_1_doc, "TDE", "TDI+8", "Tube External Diameter")
model.addParameter(Part_1_doc, "TL", "86", "Tube Length")
model.addParameter(Part_1_doc, "Width", "112", "Full Width of Base")
model.addParameter(Part_1_doc, "LegThick", "5")
model.addParameter(Part_1_doc, "BaseLegFillet", "3")
model.addParameter(Part_1_doc, "LegTopFillet", "2")
model.addParameter(Part_1_doc, "BottomCutFillet", "2")
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchLine_1 = Sketch_1.addLine(0, 84.99999999999999, 11, 85)
SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
SketchLine_2 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
SketchLine_3 = Sketch_1.addLine(11, 85, 24.4927071104659, 8.479055466987994)
SketchLine_4 = Sketch_1.addLine(27.44713036948842, 6, 56, 6)
SketchLine_5 = Sketch_1.addLine(56, 6, 56, 0)
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4")
SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
SketchLine_6 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
SketchLine_7 = Sketch_1.addLine(56, 0, 20.91066030079079, 0)
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_6.result())
SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
SketchLine_8 = Sketch_1.addLine(20.91066030079079, 0, 17.67553693029129, 18.34729635533419)
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8")
SketchLine_9 = Sketch_1.addLine(15.70592142426623, 20, 0, 20)
SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_2.result())
SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10")
SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result())
SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result())
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_6.result(), 6, True)
SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.endPoint(), SketchLine_6.result(), 20, True)
SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_2.result(), "Width/2", True)
SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_4.result(), SketchLine_3.result(), "Draft")
SketchArc_1 = Sketch_1.addArc(15.70592142426623, 18, 17.67553693029129, 18.34729635533419, 15.70592142426623, 20, False)
SketchPoint_1 = Sketch_1.addPoint(17.3841206866215, 20)
SketchPoint_1.setAuxiliary(True)
SketchConstraintDistance_4 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_3.result(), "LegThick", True)
SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_8.result())
SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11")
SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_9.result())
SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12")
SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.endPoint())
SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13")
SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_9.startPoint())
SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_14")
SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_8.result())
SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_9.result())
SketchPoint_2 = Sketch_1.addPoint(11, 85)
SketchPoint_2.setAuxiliary(True)
SketchConstraintDistance_5 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_7.result(), 85, True)
SketchConstraintDistance_6 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchLine_2.result(), "TDE/2", True)
SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result())
SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_15")
SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.result())
SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16")
SketchArc_2 = Sketch_1.addArc(27.44713036950173, 9.00000000000146, 24.4927071104659, 8.479055466987994, 27.44713036948842, 6, False)
SketchArc_2.setName("SketchArc_3")
SketchArc_2.result().setName("SketchArc_3")
SketchArc_2.results()[1].setName("SketchArc_3_2")
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.endPoint())
SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19")
SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint())
SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20")
SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result())
SketchConstraintTangent_3.setName("SketchConstraintTangent_5")
SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result())
SketchConstraintTangent_4.setName("SketchConstraintTangent_6")
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], "BaseLegFillet")
SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], "LegTopFillet")
SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_3.result(), SketchLine_8.result())
SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchPoint_2.coordinates())
SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_17")
SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.endPoint())
SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18")
SketchConstraintMirror_1_objects = [SketchLine_3.result(), SketchLine_1.result(), SketchLine_4.result(), SketchLine_7.result(), SketchArc_2.results()[1], SketchLine_5.result(), SketchLine_8.result(), SketchLine_9.result(), SketchArc_1.results()[1]]
SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), SketchConstraintMirror_1_objects)
[SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchArc_3, SketchLine_14, SketchLine_15, SketchLine_16, SketchArc_4] = SketchConstraintMirror_1.mirrored()
SketchArc_4.setName("SketchArc_5")
SketchArc_4.result().setName("SketchArc_5")
SketchArc_4.results()[1].setName("SketchArc_5_2")
SketchArc_3.setName("SketchArc_4")
SketchArc_3.result().setName("SketchArc_4")
SketchArc_3.results()[1].setName("SketchArc_4_2")
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
SketchLine_17 = Sketch_2.addLine(-18, 39.99999999999999, 18, 39.99999999999999)
SketchLine_18 = Sketch_2.addLine(20, 37.99999999999999, 20, -5)
SketchLine_19 = Sketch_2.addLine(20, -5, -20, -5)
SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_22")
SketchLine_20 = Sketch_2.addLine(-20, -5, -20, 37.99999999999999)
SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint())
SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23")
SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_18.result())
SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_20.result())
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_17.result())
SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_19.result())
SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
SketchLine_21 = SketchProjection_3.createdFeature()
SketchArc_5 = Sketch_2.addArc(18, 37.99999999999999, 20, 37.99999999999999, 18, 39.99999999999999, False)
SketchArc_5.setName("SketchArc_6")
SketchArc_5.result().setName("SketchArc_6")
SketchArc_5.results()[1].setName("SketchArc_6_2")
SketchPoint_3 = Sketch_2.addPoint(20, 40)
SketchPoint_3.setAuxiliary(True)
SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_3.coordinates(), SketchLine_21.result(), 40, True)
SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_17.result())
SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_25")
SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_18.result())
SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_26")
SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchArc_5.startPoint(), SketchLine_18.startPoint())
SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_27")
SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_17.endPoint())
SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_28")
SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_17.result())
SketchConstraintTangent_5.setName("SketchConstraintTangent_7")
SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_5.results()[1], SketchLine_18.result())
SketchConstraintTangent_6.setName("SketchConstraintTangent_8")
SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_5.results()[1], "BottomCutFillet")
SketchArc_6 = Sketch_2.addArc(-18, 37.99999999999999, -18, 39.99999999999999, -20, 37.99999999999999, False)
SketchArc_6.setName("SketchArc_7")
SketchArc_6.result().setName("SketchArc_7")
SketchArc_6.results()[1].setName("SketchArc_7_2")
SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_6.startPoint(), SketchLine_17.startPoint())
SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_24")
SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_6.endPoint(), SketchLine_20.endPoint())
SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29")
SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_17.result())
SketchConstraintTangent_7.setName("SketchConstraintTangent_9")
SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_6.results()[1], SketchLine_20.result())
SketchConstraintTangent_8.setName("SketchConstraintTangent_10")
SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_6.results()[1], "BottomCutFillet")
SketchConstraintDistance_8 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_21.result(), 5, True)
SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
SketchLine_22 = SketchProjection_4.createdFeature()
SketchConstraintDistance_9 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
SketchConstraintDistance_10 = Sketch_2.setDistance(SketchLine_19.endPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
model.do()
Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_11"), model.selection("EDGE", "Sketch_1/SketchLine_10"), model.selection("EDGE", "Sketch_1/SketchArc_4_2"), model.selection("EDGE", "Sketch_1/SketchLine_12"), model.selection("EDGE", "Sketch_1/SketchLine_14"), model.selection("EDGE", "Sketch_1/SketchLine_13"), model.selection("EDGE", "Sketch_1/SketchLine_15"), model.selection("EDGE", "Sketch_1/SketchArc_5_2"), model.selection("EDGE", "Sketch_1/SketchLine_16"), model.selection("EDGE", "Sketch_1/SketchLine_9"), model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchArc_3_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_1")]
Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
Wire_2_objects = [model.selection("EDGE", "Sketch_2/SketchLine_17"), model.selection("EDGE", "Sketch_2/SketchArc_7_2"), model.selection("EDGE", "Sketch_2/SketchLine_20"), model.selection("EDGE", "Sketch_2/SketchLine_19"), model.selection("EDGE", "Sketch_2/SketchLine_18"), model.selection("EDGE", "Sketch_2/SketchArc_6_2")]
Wire_2 = model.addWire(Part_1_doc, Wire_2_objects)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection(), 10, 0)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection(), 10, 0)
Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_1_1")])
model.do()
model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc)
model.end()
